package org.fei.demo.spi;

import org.fei.demo.spi.inter.UploadCDN;

import java.util.ServiceLoader;

/**
 * @author xff
 * 关键类：ServiceLoader
 * 按照Java标准，文件必须放在类路径下META-INF/services
 * 文件名必须以接口类权限定名命名org.fei.demo.spi.UploadCDN
 * 文件内容必须为实现类的权限定名：
 * org.fei.demo.spi.impl.ChinaNetCDN
 * org.fei.demo.spi.impl.QiyiCDN
 */
public class SpiMain {
    public static void main(String[] args) {
        ServiceLoader<UploadCDN> loaders = ServiceLoader.load(UploadCDN.class);
        for (UploadCDN uploadCDN : loaders){
            uploadCDN.upload("filePath");
        }
    }
}
